Skip to content

fix(worktree-reaper): validate config at load (#6394) - #8482

Merged
dezren39 merged 1 commit into
mainfrom
queue/10809-6394-reaper-config-validation
Nov 11, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/10809-6394-reaper-config-validation

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Closes #6394.

Bug: load_config in infra/worktree-reaper/bin/worktree_reaper.py merged the config file and the install overlay with no validation: a typo'd deny_* key silently disarmed the denylist of a deletion tool, string-typed deny_paths silently iterated character-by-character, wrong-shaped top levels crashed with messages that never named the file, malformed JSON was a raw traceback, and wrong-typed scalars (e.g. quiet_hours: "6") exploded mid-run.

Fix:

  • _load_json_object — both files are read through it: read errors and JSON errors raise ConfigError naming the file; the top level must be a JSON object.
  • validate_config — per file, before merging (so the error attributes to the right file): unknown keys are refused (with the valid key list in the message); types are taken from DEFAULT_CONFIG (list keys must be lists of strings, fetch a bool, strings strings, numerics numbers — never bools — and non-negative).
  • main catches ConfigError → worktree-reaper: cannot load config: <file>: <reason>, exit 2. Valid config + overlay merge behavior is unchanged (deny lists still append, scalars still override).

Tests (oracle: the issue's five failure modes + the packet acceptance):

  • New ConfigValidationTests (8 tests): typo'd deny key in config and in overlay, string-typed deny_paths, top-level list in config and in overlay, malformed JSON, string-typed quiet_hours, and valid config+overlay merge unchanged.
  • Full suite on the laptop: python3 tests/test_worktree_reaper.py — 28 tests, OK.
  • Real binary verified: malformed JSON and the typo case both print the clean naming-the-file error and exit 2, no traceback.

Queue: task 10809 (inline triage + fix per runbook §1c), lane code-w.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 03:06
@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5cb6be2e-2651-40c9-9272-94bcba11c1c3
Commits

Reviewing files that changed from the base of the PR and between e719f91 and 8042ade.

Files selected for processing: 2

  • infra/worktree-reaper/bin/worktree_reaper.py
  • infra/worktree-reaper/tests/test_worktree_reaper.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T03:08:16.769402Z 8042ade PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant